
import request from "@/utils/request"
enum Api {
  //获取属性列表
  getSpuAttrApi = '/admin/product',
  //删除属性的接口
  deleteAttrApi = '/admin/product/deleteSpu',
  //添加属性的接口
  addApi = '/admin/product/saveSpuInfo',
  //修改属性的接口
  EditApi = '/admin/product/updateSpuInfo',
  //获取所有的品牌的接口、
  getAllApi = '/admin/product/baseTrademark/getTrademarkList',
  //获取销售属性的接口
  getSaleApi = "/admin/product/baseSaleAttrList",
  //获取图片的 接口
  getspuImageApi = '/admin/product/spuImageList',
  //获取销售属性 的接口
  getAttrApi = '/admin/product/spuSaleAttrList',
  
  
}
import { useCategorySelectorStore } from "@/stores/CategoryList"
 const  Selector=useCategorySelectorStore()
//获取spu属性的列表
export const reqGetSpuListApi = (page: number, limit: number, category3Id:number) => request.get(Api.getSpuAttrApi + `/${page}/${limit}?category3Id=${Selector.category3Id}`)
 //获取所有的品牌属性
export const reqGetAllTrademark = () => request.get(Api.getAllApi)
 //获取销售属性
export const reqGetSaleAttr = () => request.get(Api.getSaleApi)
 //添加spuInfo
export const reqgETaDDData = (spuInfo) => request.post(Api.addApi, spuInfo)
//删除一个spuInfo$
export const reqDeleteSpuinfoData = (spuId: number) => request.delete(Api.deleteAttrApi + `/${spuId}`)
//获取图片的
export const reqspuImageData = (spuId: number) => request.get(Api.getspuImageApi + `/${spuId}`)
//获取销售属性
export const reqgetAttrData=(spuId:number)=>request.get(Api.getAttrApi+`/${spuId}`)

//更新spuInfo 
export const reqUpdatespuInfo = (spuInfo) => {
  return request.post(Api.EditApi,spuInfo)
}
